using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using OpenComposite.Base.Collections;
using OpenComposite.Base.Designer;
using OpenComposite.Repository.Properties;
using OpenComposite.EII.Repository;

namespace OpenComposite.EII.Designer.BRules
{
	public class IFSymbol : Symbol, IXmlSerializable
	{
		#region Initialization
		public IFSymbol()
		{
			init();
		}
		private void init()
		{
			this.BeginUpdate();

			//this.Name = "ifSymbol" + GetCount(typeof(IFSymbol));
			this.Text = "IF";

			this.Size = new Size(200, 50);
			this.MinimumSize = new Size(100, 50);

			this.Border = BorderType.Rectangle;
			this.BorderColor = Color.DarkGreen;
			this.BorderWidth = 3;

			this.NameTextBox.Visible = false;

			this.ContextMenuStrip.Items.Clear();
			this.ContextMenuStrip.Items.Add("Move Up", Resources.bmp_moveup, new EventHandler(moveUp_Click));
			this.ContextMenuStrip.Items.Add("Move Down", Resources.bmp_movedown, new EventHandler(moveDown_Click));
			this.ContextMenuStrip.Items.Add(new ToolStripSeparator());
			this.ContextMenuStrip.Items.Add("Remove", Resources.delete,
											new EventHandler(remove_Click));
			this.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);

			this.ContextMenuStrip.Items[0].ImageTransparentColor = Color.Magenta;
			this.ContextMenuStrip.Items[1].ImageTransparentColor = Color.Magenta;

			Rectangle rclient = this.CalculateClientArea();
			//
			// _condition
			//
			_condition = new Condition(this.DesignerViewControl);

			//
			// _txtResult
			//
			_txtCondition = new OpenComposite.Base.Designer.TextBox();
			_txtCondition.AutoSize = false;
			_txtCondition.BorderVisibilityStyle = BorderVisibilityStyle.Always;
			_txtCondition.Bounds = new Rectangle(0, 20, rclient.Width, rclient.Height - 20);
			_txtCondition.Anchor = System.Windows.Forms.AnchorStyles.Bottom |
				System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right |
				System.Windows.Forms.AnchorStyles.Top;
			_txtCondition.Text = "<Condition>";
			_txtCondition.ReadOnly = true;
			_txtCondition.TextChanged += new EventHandler(_txtCondition_TextChanged);
			_txtCondition.MouseClick += new System.Windows.Forms.MouseEventHandler(_txtCondition_MouseClick);

			//
			// _btnCondition
			//
			_btnCondition = new OpenComposite.Base.Designer.Button();
			_btnCondition.Bounds = new Rectangle(rclient.Right - 22, 0, 17, 15);
			_btnCondition.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
			_btnCondition.Text = "...";
			_btnCondition.Click += new EventHandler(_btnCondition_Click);

			this.Controls.Add(_txtCondition);
			this.Controls.Add(_btnCondition);

			this.EndUpdate();
		}

		#endregion

		#region Public Members

		#region Properties
		public Condition IFCondition
		{
			get { return _condition; }
			set
			{
				if ( _condition != value ) {
					_condition = value;
					doConditionChanged();
				}
			}
		}
		#endregion

		#region Override

		#region Properties
		public override bool CanFocused
		{
			get
			{
				return true;
			}
		}
		public override bool CanMove
		{
			get
			{
				return false;
			}
		}
		public override bool CanResize
		{
			get
			{
				return true;
			}
		}
		public override ResizeSides ResizableSides
		{
			get
			{
				return ResizeSides.Right | ResizeSides.Bottom;
			}
		}
		public override bool CanSelect
		{
			get
			{
				return true;
			}
		}
		public override bool IsContainer
		{
			get
			{
				return false;
			}
		}
		public override bool NoClip
		{
			get
			{
				return false;
			}
		}
		public override bool UseGrid
		{
			get
			{
				return false;
			}
		}
		#endregion

		#region Drag & Drop
		public override object GetDragObject(Point location, System.Windows.Forms.MouseButtons button)
		{
			return this;
		}
		public override bool IsDropAllowed(object obj, Point location, System.Windows.Forms.MouseButtons button)
		{
			return
				( obj is ActionSymbol && button == System.Windows.Forms.MouseButtons.Right );
		}
		public override void DropObject(object obj, Point location, System.Windows.Forms.MouseButtons button)
		{
			if ( IsDropAllowed(obj, location, button) ) {
				ActionSymbol action = (ActionSymbol)obj;
				if ( action.Parent != null && ( action.Parent is BusinessRuleSymbol || action.Parent.Parent != null ) ) {

					BusinessRuleSymbol brs = action.Parent as BusinessRuleSymbol;
					if ( brs == null ) {
						brs = action.Parent.Parent as BusinessRuleSymbol;
					}
					if ( brs != null ) {
						Route[] routes = this.DesignerViewControl.GetRoutesEndToStart(this);
						if ( routes != null && routes.Length > 0 ) {
							foreach ( Route r in routes ) {
								r.Remove();
							}
						}
						Condition c = new Condition(this.DesignerViewControl);
						c.LeftPart = ConditionPartType.Rule;
						c.LeftValueString = brs.Text;
						c.LeftRuleID = brs.RepositoryItem.ID;
						c.Operator = ConditionOperator.Equals;
						c.RightPart = ConditionPartType.ResultString;
						c.RightValueString = action.ResultString;

						this.IFCondition = c;
					}
				}
				this.DesignerViewControl.AddRoute((DesignerControl)obj, this);
			}
		}
		#endregion

		#region Paint
		public override void PaintBackground(System.Windows.Forms.PaintEventArgs pe)
		{
			base.PaintBackground(pe);
			Rectangle rect = this.GetPaintClientArea();
			Rectangle rectTitle = new Rectangle(rect.Location, new Size(rect.Width, 20));
			pe.Graphics.DrawString(this.Text, this.Font, this.ForeBrush, rectTitle);
		}
		public override void Paint(System.Windows.Forms.PaintEventArgs pe)
		{
			base.Paint(pe);
		}

		public void RefreshConditions()
		{
			doConditionChanged();
			this.Refresh();
		}
		#endregion

		#endregion

		#endregion

		#region Protected Members

		#region Override
		#endregion

		#endregion

		#region Private Members

		#region Variables
		private OpenComposite.Base.Designer.TextBox _txtCondition;
		private OpenComposite.Base.Designer.Button _btnCondition;
		private Condition _condition;

		#endregion

		#region Methods
		private void autoSize()
		{
			Graphics g = Graphics.FromHwnd(this.DesignerViewControl.Handle);
			if ( g == null ) return;
			SizeF size = g.MeasureString(_txtCondition.Text, _txtCondition.Font, _txtCondition.Width,
				new StringFormat(
					StringFormatFlags.DirectionRightToLeft |
					StringFormatFlags.FitBlackBox |
					StringFormatFlags.LineLimit));
			Size old = this.Size;
			old = old - _txtCondition.Size;
			old = old + Size.Ceiling(size);
			if ( old.Width < 200 ) old.Width = 200;
			this.Size = old;
		}
		private void doConditionChanged()
		{
			if ( this.IFCondition != null )
				_txtCondition.Text = this.IFCondition.ToString();
			else
				_txtCondition.Text = "<Condition>";

			autoSize();
		}
		FormIFEntry ifentry = null;
		private void showIFEntry()
		{
			if ( this.DesignerViewControl.ViewControls.Contains(ifentry) ) {
				this.DesignerViewControl.ViewControls.Remove(ifentry);
			}

			DesignController dc = this.DesignerViewControl.DesignController as DesignController;

			int workflowId = -1;
			BindingListEx<IRepositoryItem> parents = Global.Data.GetRepositoryHierarchyParentsList(dc.RepositoryItem);
			if ( parents.Count == 1 ) workflowId = parents[0].ID;

			ifentry = new FormIFEntry(this.DesignerViewControl, dc != null ? dc.DomainID : -1, workflowId);
			//ifentry.Location = this.DesignerViewControl.PointToScreen(this.PointToDesignerView(new Point(0, 20)));
			ifentry.Location = this.PointToDesignerView(new Point(0, 20));
			ifentry.Condition = this.IFCondition;
			ifentry.FormClosed += new System.Windows.Forms.FormClosedEventHandler(ifentry_FormClosed);
			try {
				this.DesignerViewControl.ViewControls.Add(ifentry);
				ifentry.BringToFront();
				ifentry.Show();
				//ifentry.Show();
			} catch { }
			//if ( ifentry.ShowDialog(this.DesignerViewControl) == System.Windows.Forms.DialogResult.OK ) {
			//    this.IFCondition = ifentry.Condition;
			//}
		}

		private void ifentry_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
		{
			FormIFEntry ifentry = sender as FormIFEntry;
			if ( ifentry != null ) {
				ifentry.FormClosed -= new System.Windows.Forms.FormClosedEventHandler(ifentry_FormClosed);
				if ( ifentry.DialogResult == System.Windows.Forms.DialogResult.OK ) {
					this.IFCondition = ifentry.Condition;
				}
			}
		}
		#endregion

		#region Event Handlers

		private void _txtCondition_TextChanged(object sender, EventArgs e)
		{
		}
		private void _txtCondition_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			showIFEntry();
		}

		private void _btnCondition_Click(object sender, EventArgs e)
		{
			showIFEntry();
		}

		private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
		{
			BusinessRuleSymbol brs = this.Parent as BusinessRuleSymbol;
			if ( brs == null )
				return;

			int index = brs.IfList.IndexOf(this);
			bool moveup = true;
			bool movedown = true;
			bool isLastIf = ( brs.IfList.Count == 1 );
			if ( index == 0 ) { // is first then item
				// no move up
				moveup = false;
			} else if ( index == ( brs.IfList.Count - 1 ) ) {	// is last then item
				// no move down
				movedown = false;
			}
			this.ContextMenuStrip.Items[0].Enabled = moveup && !isLastIf;
			this.ContextMenuStrip.Items[1].Enabled = movedown && !isLastIf;
			this.ContextMenuStrip.Items[3].Enabled = !isLastIf;
		}

		private void moveUp_Click(object sender, EventArgs e)
		{
			BusinessRuleSymbol brs = this.Parent as BusinessRuleSymbol;
			if ( brs == null )
				return;

			int index = brs.IfList.IndexOf(this);
			if ( index > 0 ) {
				brs.IfList.Remove(this);
				brs.IfList.Insert(index - 1, this);
				brs.RefreshSymbols();
			}
		}
		private void moveDown_Click(object sender, EventArgs e)
		{
			BusinessRuleSymbol brs = this.Parent as BusinessRuleSymbol;
			if ( brs == null )
				return;

			int index = brs.IfList.IndexOf(this);
			if ( index < brs.IfList.Count - 1 ) {
				brs.IfList.Remove(this);
				brs.IfList.Insert(index + 1, this);
				brs.RefreshSymbols();
			}
		}
		private void remove_Click(object sender, EventArgs e)
		{
			BusinessRuleSymbol brs = this.Parent as BusinessRuleSymbol;
			if ( brs == null )
				return;
			brs.IfList.Remove(this);
			this.Remove();
			brs.RefreshSymbols();
		}

		#endregion

		#endregion

		#region IConnector Members

		public Point GetRouteStart(RouteDockDirection dock)
		{
			Rectangle bounds = this.GetPaintBounds();
			return new Point(bounds.Right, bounds.Top + (int)( bounds.Height / 2 ));
		}

		public Point GetRouteEnd(RouteDockDirection dock)
		{
			return Point.Empty;
		}

		#endregion

		#region IConnectorFactory Members

		public override bool CreateRouteStart(DesignerControl controlEnd,
			out IConnector connector, out System.Drawing.Drawing2D.LineCap cap,
			out System.Drawing.Drawing2D.CustomLineCap customcap, out RouteDockDirection dockStart,
			out RouteDockDirection dockEnd, out bool useStartConnectorAsRouteStart)
		{
			bool bOK = base.CreateRouteStart(controlEnd,
				out connector, out cap, out customcap, out dockStart, out dockEnd, out useStartConnectorAsRouteStart);

			dockStart = RouteDockDirection.Right;
			return bOK;
		}

		public override bool CreateRouteEnd(DesignerControl controlStart,
			out IConnector connector, out System.Drawing.Drawing2D.LineCap cap,
			out System.Drawing.Drawing2D.CustomLineCap customcap, out RouteDockDirection dockStart,
			out RouteDockDirection dockEnd, out bool useEndConnectorAsRouteEnd)
		{
			connector = null;
			cap = System.Drawing.Drawing2D.LineCap.Flat;
			customcap = null;
			dockStart = RouteDockDirection.Right;
			dockEnd = RouteDockDirection.Left;
			useEndConnectorAsRouteEnd = false;

			return false;
		}

		#endregion

		#region IXmlSerializable Members

		public override XmlSchema GetSchema()
		{
			return null;
		}

		public override void ReadXml(XmlReader reader)
		{
			while ( reader.Read() ) {
				switch ( reader.Name ) {
					case "DesignerControl":
						if ( reader.NodeType == XmlNodeType.EndElement )
							return;
						break;
					case "Condition":
						if ( reader.NodeType == XmlNodeType.Element ) {
							Condition c = new Condition(this.DesignerViewControl);
							c.ReadXml(reader);
							this.IFCondition = c;
						}
						break;
					default:
						ReadStandardProperties(reader);
						break;
				}
			}
		}

		public override void WriteXml(XmlWriter writer)
		{
			WriteStandardProperties(writer);

			writer.WriteStartElement("Condition");
			this.IFCondition.WriteXml(writer);
			writer.WriteEndElement();
		}

		#endregion

		#region Class: Condition
		[XmlType(Namespace = "http://www.theopencomposite.com/Repository")]
		public class Condition
		{
			#region Initialization
			protected Condition()
			{
				_serviceProvider = null;

				_leftPart = ConditionPartType.String;
				_leftValueString = "";
				_leftDataTypeString = "string";
				_leftRuleID = 0;
				_leftNounID = 0;
				_operator = ConditionOperator.Equals;
				_rightPart = ConditionPartType.String;
				_rightValueString = "";
				_rightDataTypeString = "string";
				_rightRuleID = 0;
				_rightNounID = 0;
			}
			public Condition(IServiceProvider serviceProvider)
			{
				_serviceProvider = serviceProvider;

				_leftPart = ConditionPartType.String;
				_leftValueString = "";
				_leftDataTypeString = "string";
				_leftRuleID = 0;
				_leftNounID = 0;
				_operator = ConditionOperator.Equals;
				_rightPart = ConditionPartType.String;
				_rightValueString = "";
				_rightDataTypeString = "string";
				_rightRuleID = 0;
				_rightNounID = 0;
			}
			public Condition(IServiceProvider serviceProvider,
				ConditionPartType leftType, string left, ConditionOperator op,
				ConditionPartType rightType, string right)
				: this(serviceProvider)
			{
				_leftPart = leftType;
				_leftValueString = left;
				_operator = op;
				_rightPart = rightType;
				_rightValueString = right;
			}
			#endregion

			#region Properties
			private ConditionPartType _leftPart;
			public ConditionPartType LeftPart
			{
				get { return _leftPart; }
				set { _leftPart = value; }
			}
			private string _leftValueString;
			public string LeftValueString
			{
				get { return _leftValueString; }
				set { _leftValueString = value; }
			}
			private string _leftDataTypeString;
			public string LeftDataTypeString
			{
				get { return _leftDataTypeString; }
				set { _leftDataTypeString = value; }
			}
			private int _leftRuleID;
			public int LeftRuleID
			{
				get { return _leftRuleID; }
				set { _leftRuleID = value; }
			}
			private int _leftNounID;
			public int LeftNounID
			{
				get { return _leftNounID; }
				set { _leftNounID = value; }
			}
			private int _leftRuleConstID;
			public int LeftRuleConstID
			{
				get { return _leftRuleConstID; }
				set { _leftRuleConstID = value; }
			}
			private int _leftProcessVarID;
			public int LeftProcessVariableID
			{
				get { return _leftProcessVarID; }
				set { _leftProcessVarID = value; }
			}


			private ConditionOperator _operator;
			public ConditionOperator Operator
			{
				get { return _operator; }
				set { _operator = value; }
			}
			private ConditionPartType _rightPart;
			public ConditionPartType RightPart
			{
				get { return _rightPart; }
				set { _rightPart = value; }
			}
			private string _rightValueString;
			public string RightValueString
			{
				get { return _rightValueString; }
				set { _rightValueString = value; }
			}
			private string _rightDataTypeString;
			public string RightDataTypeString
			{
				get { return _rightDataTypeString; }
				set { _rightDataTypeString = value; }
			}
			private int _rightRuleID;
			public int RightRuleID
			{
				get { return _rightRuleID; }
				set { _rightRuleID = value; }
			}
			private int _rightNounID;
			public int RightNounID
			{
				get { return _rightNounID; }
				set { _rightNounID = value; }
			}
			private int _rightRuleConstID;
			public int RightRuleConstID
			{
				get { return _rightRuleConstID; }
				set { _rightRuleConstID = value; }
			}
			private int _rightProcessVarID;
			public int RightProcessVariableID
			{
				get { return _rightProcessVarID; }
				set { _rightProcessVarID = value; }
			}


			private IServiceProvider _serviceProvider;
			private RepositoryService RepositorySvc
			{
				get { return (RepositoryService)_serviceProvider.GetService(typeof(RepositoryService)); }
			}


			#endregion

			#region Methods
			public static string GetConditionOperatorString(ConditionOperator op)
			{
				string strOp = "";
				switch ( op ) {
					case ConditionOperator.Equals:
						strOp = "=";
						break;
					case ConditionOperator.NotEquals:
						strOp = "<>";
						break;
					case ConditionOperator.Greater:
						strOp = ">";
						break;
					case ConditionOperator.Less:
						strOp = "<";
						break;
					case ConditionOperator.GreaterEquals:
						strOp = ">=";
						break;
					case ConditionOperator.LessEquals:
						strOp = "<=";
						break;
					case ConditionOperator.Contains:
						strOp = "Contains";
						break;
					case ConditionOperator.NotContains:
						strOp = "NotContains";
						break;
					case ConditionOperator.HasValue:
						strOp = "Has Value";
						break;
					case ConditionOperator.HasNoValue:
						strOp = "Does Not Have Value";
						break;
				}
				return strOp;
			}

			public override string ToString()
			{
				string leftval = getDisplayString(this.LeftPart, this.LeftNounID, this.LeftRuleID,
												  this.LeftRuleConstID, this.LeftProcessVariableID, this.LeftValueString);
				string rightval = getDisplayString(this.RightPart, this.RightNounID, this.RightRuleID,
												  this.RightRuleConstID, this.RightProcessVariableID, this.RightValueString);

				if ( this.Operator == ConditionOperator.HasValue ||
					 this.Operator == ConditionOperator.HasNoValue ) {
					return string.Format("{0} {1}",
						leftval, Condition.GetConditionOperatorString(this.Operator));
				} else {
					return string.Format("{0} {1} {2}",
						leftval, Condition.GetConditionOperatorString(this.Operator), rightval);
				}
			}

			private string getDisplayString(ConditionPartType parttype,
											int idNoun, int idRule, int idRuleConst, int idProcessVar, string valuestring)
			{
				string value = valuestring;
				if ( parttype == ConditionPartType.Variable ) {
					Repository.Noun noun = this.RepositorySvc.GetItem(
						OpenComposite.EII.Repository.ItemType.Noun, idNoun, false) as Repository.Noun;
					if ( noun != null )
						value = "[" + noun.Name + "]";
				} else if ( parttype == ConditionPartType.Rule ) {
					Repository.RepositoryBusinessRule rule = this.RepositorySvc.GetItem(
						OpenComposite.EII.Repository.ItemType.BRule, idRule, false) as Repository.RepositoryBusinessRule;
					if ( rule != null )
						value = rule.Name;
				} else if ( parttype == ConditionPartType.RuleConstant ) {
					Repository.RuleConstant rconst = this.RepositorySvc.GetItem(
						OpenComposite.EII.Repository.ItemType.RuleConstant, idRuleConst, false) as Repository.RuleConstant;
					if ( rconst != null )
						value = "[" + rconst.Display + "]";
				} else if ( parttype == ConditionPartType.String || parttype == ConditionPartType.ResultString ) {
					value = "\"" + value + "\"";
				} else if ( parttype == ConditionPartType.ProcessVariable ) {
					WorkflowField field = this.RepositorySvc.GetItem<WorkflowField>(idProcessVar);
					if ( field != null )
						value = "[" + field.Name + "]";
				}
				return value;
			}

			public void ReadXml(XmlReader reader)
			{
				while ( reader.Read() ) {
					switch ( reader.Name ) {
						case "Condition":
							if ( reader.NodeType == XmlNodeType.EndElement )
								return;
							break;
						case "LeftPartType":
							this.LeftPart = (ConditionPartType)Enum.Parse(typeof(ConditionPartType), reader.ReadString());
							break;
						case "LeftValueString":
							this.LeftValueString = reader.ReadString();
							break;
						case "LeftDataTypeString":
							this.LeftDataTypeString = reader.ReadString();
							break;
						case "LeftRuleID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.LeftRuleID = id;
							}
							break;
						case "LeftNounID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.LeftNounID = id;
							}
							break;
						case "LeftRuleConstID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.LeftRuleConstID = id;
							}
							break;
						case "LeftProcessVariableID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.LeftProcessVariableID = id;
							}
							break;
						case "Operator":
							this.Operator = (ConditionOperator)Enum.Parse(typeof(ConditionOperator), reader.ReadString());
							break;
						case "RightPartType":
							this.RightPart = (ConditionPartType)Enum.Parse(typeof(ConditionPartType), reader.ReadString());
							break;
						case "RightValueString":
							this.RightValueString = reader.ReadString();
							break;
						case "RightDataTypeString":
							this.RightDataTypeString = reader.ReadString();
							break;
						case "RightRuleID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.RightRuleID = id;
							}
							break;
						case "RightNounID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.RightNounID = id;
							}
							break;
						case "RightRuleConstID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.RightRuleConstID = id;
							}
							break;
						case "RightProcessVariableID": {
								int id;
								if ( int.TryParse(reader.ReadString(), out id) )
									this.RightProcessVariableID = id;
							}
							break;
					}
				}
			}
			public void WriteXml(XmlWriter writer)
			{
				writer.WriteElementString("LeftPartType", this.LeftPart.ToString());
				writer.WriteElementString("LeftValueString", this.LeftValueString);
				writer.WriteElementString("LeftDataTypeString", this.LeftDataTypeString);
				writer.WriteElementString("LeftRuleID", this.LeftRuleID.ToString());
				writer.WriteElementString("LeftNounID", this.LeftNounID.ToString());
				writer.WriteElementString("LeftRuleConstID", this.LeftRuleConstID.ToString());
				writer.WriteElementString("LeftProcessVariableID", this.LeftProcessVariableID.ToString());
				writer.WriteElementString("Operator", this.Operator.ToString());
				writer.WriteElementString("RightPartType", this.RightPart.ToString());
				writer.WriteElementString("RightValueString", this.RightValueString);
				writer.WriteElementString("RightDataTypeString", this.RightDataTypeString);
				writer.WriteElementString("RightRuleID", this.RightRuleID.ToString());
				writer.WriteElementString("RightNounID", this.RightNounID.ToString());
				writer.WriteElementString("RightRuleConstID", this.RightRuleConstID.ToString());
				writer.WriteElementString("RightProcessVariableID", this.RightProcessVariableID.ToString());
			}
			#endregion

		}
		#endregion

		#region Enum: ConditionPartType
		public enum ConditionPartType
		{
			String,
			Number,
			Variable,
			Rule,
			Boolean,
			ResultString,
			DateTime,
			RuleConstant,
			ProcessVariable
		}
		#endregion
		#region Enum: ConditionOperator
		public enum ConditionOperator
		{
			Equals,
			NotEquals,
			Greater,
			Less,
			GreaterEquals,
			LessEquals,
			Contains,
			NotContains,
			HasValue,
			HasNoValue
		}
		#endregion

	}
}
